package com.niiwoo.civet.mobile.vo.response.invest;

import java.math.BigDecimal;
import java.util.List;

import com.niiwoo.civet.mobile.vo.common.LinkageConfig;
import com.niiwoo.civet.mobile.vo.common.LinkageConfig.PeriodValue;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@ApiModel("批量投资详情")
public class BatchInvestSettingInfoResponseVO {

	@ApiModelProperty("联动配置")
	private List<LinkageConfig> linkageConfigs;

	@ApiModelProperty(value = "批量投资用户配置")
	private UserConfig userConfig;

	@ApiModelProperty("自动投资开启状态，0-未开启，1-开启")
	private Byte enableAuto;

	@ApiModelProperty(value = "批量投资默认配置")
	private DefaultConfig defaultConfig;

	@ApiModelProperty("合同url信息")
	private ContractInfo contractInfo;
	
    @ApiModelProperty("起投金额")
    private BigDecimal minInvestAmount;

	public DefaultConfig defaultConfig() {
		this.defaultConfig = new DefaultConfig();
		return defaultConfig;
	}

	public ContractInfo contract() {
		this.contractInfo = new ContractInfo();
		return contractInfo;
	}

	@Setter
	@Getter
	@ApiModel("批量投资用户配置")
	public static class UserConfig {
		@ApiModelProperty("选中的产品类型")
        private List<Byte> productTypes;
        @ApiModelProperty("选中的期限")
        private List<PeriodValue> periodTypes;
        @ApiModelProperty("选中的还款方式")
        private List<Byte> repaymentTypes;
        @ApiModelProperty("选中的利率")
        private List<BigDecimal> ratetTypes;
		@ApiModelProperty("是否后台关闭，0-否，1-是")
        private Byte enableSystem;
		@ApiModelProperty("单笔投资上限金额")
		private BigDecimal singleMaxInvestAmount;

		@ApiModelProperty("账户保留最低余额")
		private BigDecimal minKeepBalance;

		@ApiModelProperty("自动使用红包开启状态：0-不使用，1-使用")
		private Byte autoUsePrize;

		@ApiModelProperty("必须使用红包状态，0-否，1-是")
		private Byte mustUsePrize;

		@ApiModelProperty("使用加息券的最低投资金额")
		private BigDecimal useCouponMinInvestAmount;

		@ApiModelProperty("批量投资的条件是否同步到自动投资：0:-不同步，1-同步")
		private Byte syncToAutoInvest;
	}

	@Getter
	@ApiModel("批量投资默认配置")
	public static class DefaultConfig {
		@ApiModelProperty("单笔投资上限金额")
		private BigDecimal singleMaxInvestAmount;

		@ApiModelProperty("账户保留最低余额")
		private BigDecimal minKeepBalance;

		@ApiModelProperty("自动使用红包开启状态：0-不使用，1-使用")
		private Byte autoUsePrize = 0;

		@ApiModelProperty("必须使用红包状态，0-否，1-是")
		private Byte mustUsePrize = 0;

		@ApiModelProperty("使用加息券的最低投资金额")
		private BigDecimal useCouponMinInvestAmount = BigDecimal.valueOf(2_000.00d);

		@ApiModelProperty("批量投资的条件是否同步到自动投资：0:-不同步，1-同步")
		private Byte syncToAutoInvest = 0;

		public DefaultConfig singleMax(BigDecimal singleMaxInvestAmount) {
			this.singleMaxInvestAmount = singleMaxInvestAmount;
			return this;
		}

		public DefaultConfig minKeep(BigDecimal minKeepBalance) {
			this.minKeepBalance = minKeepBalance;
			return this;
		}

		public DefaultConfig useCouponMin(BigDecimal useCouponMinInvestAmount) {
			this.useCouponMinInvestAmount = useCouponMinInvestAmount;
			return this;
		}

	}

	@Getter
	@ApiModel("合同url信息")
	public static class ContractInfo {
		@ApiModelProperty("自动、批量投资居间借款合同url")
		private String autoInvestContractUrl;

		@ApiModelProperty("风险提示书Url")
		private String riskTipsUrl;

		@ApiModelProperty("投资委托授权协议书url")
		private String commissionAuthorizeAgreementUrl;

		public ContractInfo investContract(String autoInvestContractUrl) {
			this.autoInvestContractUrl = autoInvestContractUrl;
			return this;
		}

		public ContractInfo riskTips(String riskTipsUrl) {
			this.riskTipsUrl = riskTipsUrl;
			return this;
		}

		public ContractInfo authorizeAgreement(String commissionAuthorizeAgreementUrl) {
			this.commissionAuthorizeAgreementUrl = commissionAuthorizeAgreementUrl;
			return this;
		}

	}

	 
}
